/*
 * @Descripttion: 
 * @version: 
 * @Author: cyj
 * @Date: 2022-12-28 11:19:55
 */
import request from "../../utils/request";

//给评论点赞   调用此接口 , 传入 type, 资源 id, 和评论 id cid 和 是否点赞参数 t 即可给对 应评论点赞 ( 需要登录 )
export const isLikeComment = (id, cid, t, type, cookie) => request({
    url: '/comment/like',
    method: 'GET',
    params: {
        id,
        type,
        cid, // 评论 id
        t,  //是否点赞 , 1 为点赞 ,0 为取消点赞
        cookie,
    }
})

//发送评论
export const sendComment = (type, id, content) => request({
    url: '/comment',
    method: 'GET',
    params: {
        t: 1,
        type,
        id,
        content,
        timestamp: Date.parse(new Date()),

    }
})

//回复评论
export const replyComment = (type, id, content, commentId) => request({
    url: '/comment',
    method: 'GET',
    params: {
        t: 2,
        type,
        id,
        content,
        commentId,
        timestamp: Date.parse(new Date()),
    }
})

//获取最新评论 传入资源类型，用作判断  对应歌曲 , mv, 专辑 , 歌单 , 电台, 视频
export const getNewComment = (type, id, offset) => request({
    url: `/comment/${type}`,
    method: 'GET',
    params: {
        id,
        offset,
        limit: 60
    }
})

//获取热门评论|精彩评论  有些歌单会没有数据
export const getHotComment = (type, id, offset) => request({
    url: '/comment/hot',
    method: 'GET',
    params: {
        type,
        id,
        offset
    }
})
